home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / ODF Release 3 / ODFDev / Form / Sources / ScrollEd.h < prev    next >
Encoding:
Text File  |  1996-12-16  |  3.6 KB  |  110 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                ScrollEd.h
  4. //    Release Version:    $ ODF 3 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef SCROLLED_H
  11. #define SCROLLED_H
  12.  
  13. #ifndef DEFINES_K
  14. #include "Defines.k"
  15. #endif
  16.  
  17. #ifndef FWEDVIEW_H
  18. #include "FWEdView.h"
  19. #endif
  20.  
  21. #ifndef FWRECEVR_H
  22. #include "FWRecevr.h"
  23. #endif
  24.  
  25. #if FW_PPOB_VIEWS
  26. #include "FWPPobOb.h"
  27. #endif
  28.  
  29. //==============================================================================
  30. // Forward Declarations
  31. //==============================================================================
  32.  
  33. class FW_CScrollBar;
  34. class FW_CNotification;
  35.  
  36. //==============================================================================
  37. // class CScrollEdit
  38. //==============================================================================
  39. // CScrollEdit adds scrolling & undo functionalities to FW_CEditView.
  40. // See CScrollEdit's documentation at the top of the .cpp file
  41.  
  42. class CScrollEdit : public FW_CEditView, public FW_MReceiver
  43. {
  44.   public:
  45.     FW_DECLARE_CLASS
  46.     FW_DECLARE_AUTO(CScrollEdit)
  47.  
  48.     // 1 step constructor
  49.     CScrollEdit(Environment* ev, 
  50.                 FW_CSuperView* container, 
  51.                 const FW_CRect& bounds,
  52.                 ODID viewID, 
  53.                 FW_CScrollBar* horzSB,
  54.                 FW_CScrollBar* vertSB,
  55.                 const FW_CString& text, 
  56.                 const FW_CFont& font = FW_kNormalFont,
  57.                 short maxChars = FW_MAXINT16, 
  58.                 unsigned short attributes = FW_CEditView::kDrawBox + 
  59.                                             FW_CEditView::kWordWrap + 
  60.                                             FW_CEditView::kAutoScroll,
  61.                 FW_Fixed textWidth = FW_kFixed0);
  62.  
  63.     // 2 steps constructor
  64.     CScrollEdit(Environment* ev);
  65.                     
  66.     virtual ~CScrollEdit();
  67.  
  68.     // ----- New API
  69.     void                         UpdateScrollParameters(Environment* ev);
  70.     void                         UpdateScrollUnits(Environment* ev);
  71.     void                         AdjustTE(Environment* ev);
  72.     void                        AdjustTERects(Environment* ev);
  73.     void                        AdjustScrollbar(Environment* ev, FW_XYSelector direction);
  74.     void                         Initialize(Environment* ev);
  75.  
  76.     // ----- Inherited API
  77.     virtual FW_Handled            DoAdjustMenus (Environment *ev, FW_CMenuBar* menuBar, 
  78.                                             FW_Boolean hasMenuFocus, FW_Boolean isRoot);
  79.     virtual FW_Handled             DoMenu (Environment* ev, const FW_CMenuEvent& event);
  80.     virtual FW_Handled             DoMouseDown (Environment* ev, const FW_CMouseEvent& event);
  81.     virtual FW_Handled             DoVirtualKeyDown (Environment* ev, const FW_CVirtualKeyEvent & event);
  82.     virtual FW_Handled             DoCharKeyDown (Environment* ev, const FW_CCharKeyEvent& event);
  83.     virtual void                 HandleNotification(Environment* ev, const FW_CNotification& notification);
  84.     virtual void                 SizeChanged (Environment* ev, const FW_CPoint& oldSize);
  85.     virtual void                 SetText (Environment * ev, const FW_CString& str);
  86.  
  87.     // ----- Archiving -----
  88. #if FW_ODFRC_VIEWS
  89.     static void*                Create(FW_CReadableStream& stream, FW_ClassTypeConstant type);
  90.     static void                    Destroy(void* object, FW_ClassTypeConstant type);
  91.     virtual void                Flatten(Environment* ev, FW_CWritableStream& stream) const;
  92.     virtual void                InitializeFromStream(Environment* ev, FW_CReadableStream& stream);
  93. #endif
  94.  
  95.   private:
  96.       FW_CScrollBar*         fScrollbars[2];        // vert & horz scrollbars (may be NULL)
  97.     FW_Fixed            fWidth;                // text width
  98. };
  99.  
  100. //========================================================================================
  101. // MetroWerks Constructor View Resource Reader
  102. //========================================================================================
  103. #if FW_PPOB_VIEWS
  104.  
  105. void ReadScrollingEdit (Environment* ev, FW_CPPobReader* context, FW_CReadableStream& stream);
  106.  
  107. #endif // FW_PPOB_VIEWS
  108.  
  109. #endif // SCROLLED_H
  110.